package cn.getech.data.development.service.impl;

import cn.getech.data.development.entity.ProcConnect;
import cn.getech.data.development.mapper.ProcConnectMapper;
import cn.getech.data.development.service.ProcConnectService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 项目连接关系表 服务实现类
 * </p>
 *
 * @author zenith
 * @since 2019-07-08
 */
@Service
public class ProcConnectServiceImpl extends ServiceImpl<ProcConnectMapper, ProcConnect> implements ProcConnectService {

    @Override
    public boolean checkIfRelation(Integer procId, Integer connId) {
        return this.baseMapper.selectCount(new QueryWrapper<ProcConnect>().eq("proc_id",procId).eq("connect_id",connId))>0;
    }

    @Override
    public boolean checkTaskRelation(Integer procId, Integer connectId) {
        Integer num = baseMapper.checkTaskRelation(procId, connectId);
        return num == 0;
    }
}
